<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>iOS开发安全笔记 | KnightSama‘s Blog</title>
    <meta name="description" content="Hello, my friend!">
    <link rel="icon" href="/favicon.ico">
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <script src="https://cdn.jsdelivr.net/npm/react/umd/react.production.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/react-dom/umd/react-dom.production.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@babel/standalone/babel.min.js"></script>
    
    <link rel="preload" href="/assets/css/0.styles.c4ea52a5.css" as="style"><link rel="preload" href="/assets/js/app.a2483de7.js" as="script"><link rel="preload" href="/assets/js/4.0078dadf.js" as="script"><link rel="preload" href="/assets/js/1.c3e7d2b0.js" as="script"><link rel="preload" href="/assets/js/18.fa3c3a4e.js" as="script"><link rel="prefetch" href="/assets/js/10.265e4f40.js"><link rel="prefetch" href="/assets/js/11.a3a2f8c1.js"><link rel="prefetch" href="/assets/js/12.1910f8cc.js"><link rel="prefetch" href="/assets/js/13.229fa478.js"><link rel="prefetch" href="/assets/js/14.c27d4a17.js"><link rel="prefetch" href="/assets/js/15.92adafd4.js"><link rel="prefetch" href="/assets/js/16.bcee7c14.js"><link rel="prefetch" href="/assets/js/17.ee1bcf41.js"><link rel="prefetch" href="/assets/js/19.1a943c57.js"><link rel="prefetch" href="/assets/js/20.44781dae.js"><link rel="prefetch" href="/assets/js/21.1fe46223.js"><link rel="prefetch" href="/assets/js/22.6f7d46c2.js"><link rel="prefetch" href="/assets/js/23.56223d02.js"><link rel="prefetch" href="/assets/js/24.e7cad43b.js"><link rel="prefetch" href="/assets/js/25.b2902552.js"><link rel="prefetch" href="/assets/js/26.70698c07.js"><link rel="prefetch" href="/assets/js/27.6ee3d263.js"><link rel="prefetch" href="/assets/js/28.ce131de6.js"><link rel="prefetch" href="/assets/js/29.90552487.js"><link rel="prefetch" href="/assets/js/30.b3291ccc.js"><link rel="prefetch" href="/assets/js/31.ea8c441e.js"><link rel="prefetch" href="/assets/js/32.3e29bbeb.js"><link rel="prefetch" href="/assets/js/33.65e78c5e.js"><link rel="prefetch" href="/assets/js/34.3ba19d7c.js"><link rel="prefetch" href="/assets/js/35.66d3fc4a.js"><link rel="prefetch" href="/assets/js/36.f5725281.js"><link rel="prefetch" href="/assets/js/37.f5b0b5ff.js"><link rel="prefetch" href="/assets/js/38.3cae3054.js"><link rel="prefetch" href="/assets/js/39.47dc1ffe.js"><link rel="prefetch" href="/assets/js/5.f0714e2e.js"><link rel="prefetch" href="/assets/js/6.53240a5f.js"><link rel="prefetch" href="/assets/js/7.dc126a6b.js"><link rel="prefetch" href="/assets/js/8.86452400.js"><link rel="prefetch" href="/assets/js/9.16ef06de.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.734d5d92.js">
    <link rel="stylesheet" href="/assets/css/0.styles.c4ea52a5.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div><div class="theme-container" data-v-0cb1c278><div data-v-0cb1c278><div id="loader-wrapper" class="loading-wrapper" data-v-4b73742e data-v-0cb1c278 data-v-0cb1c278><div class="loader-main" data-v-4b73742e><div data-v-4b73742e></div><div data-v-4b73742e></div><div data-v-4b73742e></div><div data-v-4b73742e></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-da0660ba data-v-0cb1c278 data-v-0cb1c278><h3 class="title" style="display:none;" data-v-da0660ba data-v-da0660ba>KnightSama‘s Blog</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-da0660ba data-v-da0660ba><input type="password" value="" data-v-da0660ba> <span data-v-da0660ba>Konck! Knock!</span> <button data-v-da0660ba>OK</button></label> <div class="footer" style="display:none;" data-v-da0660ba data-v-da0660ba><span data-v-da0660ba><i class="iconfont reco-theme" data-v-da0660ba></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-da0660ba>vuePress-theme-reco</a></span> <span data-v-da0660ba><i class="iconfont reco-copyright" data-v-da0660ba></i> <a data-v-da0660ba><span data-v-da0660ba>KnightSama</span>
            
          <!---->
          2021
        </a></span></div></div> <div class="hide" data-v-0cb1c278><header class="navbar" data-v-0cb1c278><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/Misaka.jpg" alt="KnightSama‘s Blog" class="logo"> <span class="site-name">KnightSama‘s Blog</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/iOS/" class="nav-link"><i class="iconfont undefined"></i>
  iOS
</a></li><li class="dropdown-item"><!----> <a href="/categories/集锦/" class="nav-link"><i class="iconfont undefined"></i>
  集锦
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/Github/" class="nav-link"><i class="iconfont undefined"></i>
  Github
</a></li><li class="dropdown-item"><!----> <a href="/categories/Python/" class="nav-link"><i class="iconfont undefined"></i>
  Python
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="https://github.com/KnightSama" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-0cb1c278></div> <aside class="sidebar" data-v-0cb1c278><div class="personal-info-wrapper" data-v-4a3def3c><img src="/Misaka.jpg" alt="author-avatar" class="personal-img" data-v-4a3def3c> <h3 class="name" data-v-4a3def3c>
    KnightSama
  </h3> <div class="num" data-v-4a3def3c><div data-v-4a3def3c><h3 data-v-4a3def3c>27</h3> <h6 data-v-4a3def3c>文章</h6></div> <div data-v-4a3def3c><h3 data-v-4a3def3c>14</h3> <h6 data-v-4a3def3c>标签</h6></div></div> <hr data-v-4a3def3c></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/iOS/" class="nav-link"><i class="iconfont undefined"></i>
  iOS
</a></li><li class="dropdown-item"><!----> <a href="/categories/集锦/" class="nav-link"><i class="iconfont undefined"></i>
  集锦
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/Github/" class="nav-link"><i class="iconfont undefined"></i>
  Github
</a></li><li class="dropdown-item"><!----> <a href="/categories/Python/" class="nav-link"><i class="iconfont undefined"></i>
  Python
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="https://github.com/KnightSama" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>iOS开发安全笔记</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/Views/20170713.html#越狱检测" class="sidebar-link">越狱检测</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/Views/20170713.html#检测应用重签名" class="sidebar-link">检测应用重签名</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/Views/20170713.html#阻止动态调试" class="sidebar-link">阻止动态调试</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/Views/20170713.html#ptrace" class="sidebar-link">ptrace</a></li><li class="sidebar-sub-header"><a href="/Views/20170713.html#sysctl" class="sidebar-link">sysctl</a></li><li class="sidebar-sub-header"><a href="/Views/20170713.html#syscall" class="sidebar-link">syscall</a></li><li class="sidebar-sub-header"><a href="/Views/20170713.html#arm" class="sidebar-link">arm</a></li></ul></li><li><a href="/Views/20170713.html#字符串加密" class="sidebar-link">字符串加密</a><ul class="sidebar-sub-headers"></ul></li></ul></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-da0660ba data-v-0cb1c278><h3 class="title" style="display:none;" data-v-da0660ba data-v-da0660ba>iOS开发安全笔记</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-da0660ba data-v-da0660ba><input type="password" value="" data-v-da0660ba> <span data-v-da0660ba>Konck! Knock!</span> <button data-v-da0660ba>OK</button></label> <div class="footer" style="display:none;" data-v-da0660ba data-v-da0660ba><span data-v-da0660ba><i class="iconfont reco-theme" data-v-da0660ba></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-da0660ba>vuePress-theme-reco</a></span> <span data-v-da0660ba><i class="iconfont reco-copyright" data-v-da0660ba></i> <a data-v-da0660ba><span data-v-da0660ba>KnightSama</span>
            
          <!---->
          2021
        </a></span></div></div> <div data-v-0cb1c278><main class="page"><div class="sidebar-open-close"><svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <!----> <div class="page-title" style="display:none;"><h1>iOS开发安全笔记</h1> <hr> <div data-v-73367bb4><i class="iconfont reco-account" data-v-73367bb4><span data-v-73367bb4>KnightSama</span></i> <i class="iconfont reco-date" data-v-73367bb4><span data-v-73367bb4>2017-07-13</span></i> <i class="iconfont reco-eye" data-v-73367bb4><span id="/Views/20170713.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-73367bb4><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-73367bb4><span class="tag-item" data-v-73367bb4>
      iOS
    </span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><p>iOS 系统虽然安全，但并非坚不可破，在应用的开发过程中我们应该要注意很多安全上的问题，这里记录了一些常用的安全方案。
</p> <h2 id="越狱检测"><a href="#越狱检测" class="header-anchor">#</a> 越狱检测</h2> <p>通过下面的方法可以检测手机是否越狱</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code><span class="token macro property">#<span class="token directive keyword">import</span> &lt;sys/stat.h&gt;</span>
<span class="token macro property">#<span class="token directive keyword">import</span> &lt;sys/sysctl.h&gt;</span>

<span class="token operator">+</span> <span class="token punctuation">(</span>BOOL<span class="token punctuation">)</span>isJailbreak<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>TARGET_IPHONE_SIMULATOR<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> NO<span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token keyword">else</span><span class="token punctuation">{</span>
        <span class="token comment">//越狱检查</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token punctuation">[</span>UIDevice currentDevice<span class="token punctuation">]</span> systemVersion<span class="token punctuation">]</span> floatValue<span class="token punctuation">]</span><span class="token operator">&lt;</span><span class="token number">9.0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token comment">//CanOpenURL检查</span>
            <span class="token keyword">@try</span> <span class="token punctuation">{</span>
<span class="token macro property">#<span class="token directive keyword">if</span> !(defined(__has_feature) &amp;&amp; __has_feature(attribute_availability_app_extension))</span>
                NSURL <span class="token operator">*</span>FakeURL <span class="token operator">=</span> <span class="token punctuation">[</span>NSURL URLWithString<span class="token punctuation">:</span><span class="token string">@&quot;cydia://package/com.fake.package&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span>UIApplication sharedApplication<span class="token punctuation">]</span> canOpenURL<span class="token punctuation">:</span>FakeURL<span class="token punctuation">]</span><span class="token punctuation">)</span>
                    <span class="token keyword">return</span> YES<span class="token punctuation">;</span>
<span class="token macro property">#<span class="token directive keyword">endif</span></span>
            <span class="token punctuation">}</span>
            <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//Cydia应用检查</span>
        <span class="token keyword">@try</span> <span class="token punctuation">{</span>
            NSString <span class="token operator">*</span>appPath <span class="token operator">=</span><span class="token string">@&quot;/Applications/Cydia.app&quot;</span><span class="token punctuation">;</span>
            FILE <span class="token operator">*</span>vf <span class="token operator">=</span> <span class="token function">fopen</span><span class="token punctuation">(</span><span class="token punctuation">[</span>appPath cStringUsingEncoding<span class="token punctuation">:</span>NSASCIIStringEncoding<span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token string">&quot;r&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>vf <span class="token operator">!=</span> <span class="token constant">NULL</span><span class="token punctuation">)</span>
                <span class="token keyword">return</span> YES<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//fork函数检查</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">fork</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">&gt;=</span><span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> YES<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//注入动态库检查</span>
        <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>env <span class="token operator">=</span> <span class="token function">getenv</span><span class="token punctuation">(</span><span class="token string">&quot;DYLD_INSERT_LIBRARIES&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>env<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> YES<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        NSInteger motzart <span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token comment">//无法访问文件检查</span>
        <span class="token keyword">@try</span> <span class="token punctuation">{</span>
            NSArray <span class="token operator">*</span>files <span class="token operator">=</span><span class="token operator">@</span><span class="token punctuation">[</span>
                              <span class="token string">@&quot;/Applications/RockApp.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Applications/Icy.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/usr/sbin/sshd&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/usr/bin/sshd&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/usr/libexec/sftp-server&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Applications/WinterBoard.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Applications/SBSettings.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Applications/MxTube.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Applications/IntelliScreen.app&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Library/MobileSubstrate/DynamicLibraries/Veency.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/Library/MobileSubstrate/DynamicLibraries/xCon.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/private/var/lib/apt&quot;</span><span class="token punctuation">,</span><span class="token string">@&quot;/private/var/stash&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/System/Library/LaunchDaemons/com.ikey.bbot.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/private/var/tmp/cydia.log&quot;</span><span class="token punctuation">,</span><span class="token string">@&quot;/private/var/lib/cydia&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/etc/clutch.conf&quot;</span><span class="token punctuation">,</span> <span class="token string">@&quot;/var/cache/clutch.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/etc/clutch_cracked.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/var/cache/clutch_cracked.plist&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/var/lib/clutch/overdrive.dylib&quot;</span><span class="token punctuation">,</span>
                              <span class="token string">@&quot;/var/root/Documents/Cracked/&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>NSString <span class="token operator">*</span>fileName <span class="token keyword">in</span> files<span class="token punctuation">)</span> <span class="token punctuation">{</span>
                FILE <span class="token operator">*</span>vf <span class="token operator">=</span> <span class="token function">fopen</span><span class="token punctuation">(</span><span class="token punctuation">[</span>fileName cStringUsingEncoding<span class="token punctuation">:</span>NSASCIIStringEncoding<span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token string">&quot;r&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>vf <span class="token operator">!=</span> <span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
                    motzart <span class="token operator">+</span><span class="token operator">=</span><span class="token number">2</span><span class="token punctuation">;</span>
                    <span class="token keyword">break</span><span class="token punctuation">;</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//plist文件检查</span>
        <span class="token keyword">@try</span> <span class="token punctuation">{</span>
            NSString <span class="token operator">*</span>exePath <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>NSBundle mainBundle<span class="token punctuation">]</span> executablePath<span class="token punctuation">]</span><span class="token punctuation">;</span>
            NSDictionary <span class="token operator">*</span>infoDict <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>NSBundle mainBundle<span class="token punctuation">]</span> infoDictionary<span class="token punctuation">]</span><span class="token punctuation">;</span>
            FILE <span class="token operator">*</span>vf <span class="token operator">=</span> <span class="token function">fopen</span><span class="token punctuation">(</span><span class="token punctuation">[</span>exePath cStringUsingEncoding<span class="token punctuation">:</span>NSASCIIStringEncoding<span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token string">&quot;r&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>vf <span class="token operator">==</span> <span class="token constant">NULL</span> <span class="token operator">||</span> infoDict <span class="token operator">==</span> nil <span class="token operator">||</span> infoDict<span class="token punctuation">.</span>count <span class="token operator">&lt;=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
                motzart <span class="token operator">+</span><span class="token operator">=</span><span class="token number">2</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token punctuation">[</span>UIDevice currentDevice<span class="token punctuation">]</span> systemVersion<span class="token punctuation">]</span> floatValue<span class="token punctuation">]</span><span class="token operator">&lt;</span><span class="token number">9.0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token comment">//进程检查</span>
            <span class="token keyword">@try</span> <span class="token punctuation">{</span>
                NSArray <span class="token operator">*</span>processes <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token keyword">self</span> runningProcesses<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">for</span> <span class="token punctuation">(</span>NSDictionary <span class="token operator">*</span> dict <span class="token keyword">in</span> processes<span class="token punctuation">)</span> <span class="token punctuation">{</span>
                    NSString <span class="token operator">*</span>process <span class="token operator">=</span> <span class="token punctuation">[</span>dict objectForKey<span class="token punctuation">:</span><span class="token string">@&quot;ProcessName&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
                    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">[</span>process isEqualToString<span class="token punctuation">:</span><span class="token string">@&quot;MobileCydia&quot;</span><span class="token punctuation">]</span><span class="token operator">||</span><span class="token punctuation">[</span>process isEqualToString<span class="token punctuation">:</span><span class="token string">@&quot;Cydia&quot;</span><span class="token punctuation">]</span><span class="token operator">||</span><span class="token punctuation">[</span>process isEqualToString<span class="token punctuation">:</span><span class="token string">@&quot;afpd&quot;</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
                        motzart <span class="token operator">+</span><span class="token operator">=</span><span class="token number">2</span><span class="token punctuation">;</span>
                        <span class="token keyword">break</span><span class="token punctuation">;</span>
                    <span class="token punctuation">}</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token punctuation">}</span>
            <span class="token comment">//符号链接检查</span>
            <span class="token keyword">@try</span> <span class="token punctuation">{</span>
                <span class="token keyword">struct</span> stat s<span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">lstat</span><span class="token punctuation">(</span><span class="token string">&quot;/Applications&quot;</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>s<span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token number">0</span> <span class="token operator">&amp;&amp;</span> <span class="token punctuation">(</span>s<span class="token punctuation">.</span>st_mode <span class="token operator">&amp;</span> S_IFLNK<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
                    motzart <span class="token operator">+</span><span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">@catch</span> <span class="token punctuation">(</span>NSException <span class="token operator">*</span>exception<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">return</span> motzart <span class="token operator">&gt;=</span> <span class="token number">3</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token operator">+</span> <span class="token punctuation">(</span>NSArray <span class="token operator">*</span><span class="token punctuation">)</span>runningProcesses <span class="token punctuation">{</span>
    
    <span class="token keyword">int</span> mib<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span>CTL_KERN<span class="token punctuation">,</span> KERN_PROC<span class="token punctuation">,</span> KERN_PROC_ALL<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
    size_t miblen <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span>
    size_t size <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> st<span class="token punctuation">;</span>
    
    <span class="token keyword">struct</span> kinfo_proc <span class="token operator">*</span> process <span class="token operator">=</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
    <span class="token keyword">struct</span> kinfo_proc <span class="token operator">*</span> newprocess <span class="token operator">=</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
    
    <span class="token keyword">do</span> <span class="token punctuation">{</span>
        size <span class="token operator">+</span><span class="token operator">=</span> <span class="token punctuation">(</span>size <span class="token operator">/</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        newprocess <span class="token operator">=</span> <span class="token function">realloc</span><span class="token punctuation">(</span>process<span class="token punctuation">,</span> size<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>newprocess<span class="token punctuation">)</span><span class="token punctuation">{</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>process<span class="token punctuation">)</span><span class="token punctuation">{</span>
                <span class="token function">free</span><span class="token punctuation">(</span>process<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">return</span> nil<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        process <span class="token operator">=</span> newprocess<span class="token punctuation">;</span>
        st <span class="token operator">=</span> <span class="token function">sysctl</span><span class="token punctuation">(</span>mib<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">)</span>miblen<span class="token punctuation">,</span> process<span class="token punctuation">,</span> <span class="token operator">&amp;</span>size<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">while</span> <span class="token punctuation">(</span>st <span class="token operator">==</span> <span class="token operator">-</span><span class="token number">1</span> <span class="token operator">&amp;&amp;</span> errno <span class="token operator">==</span> ENOMEM<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>st <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>size <span class="token operator">%</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> kinfo_proc<span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
            <span class="token keyword">int</span> nprocess <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">)</span><span class="token punctuation">(</span>size <span class="token operator">/</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> kinfo_proc<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>nprocess<span class="token punctuation">)</span><span class="token punctuation">{</span>
                NSMutableArray <span class="token operator">*</span> array <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>NSMutableArray alloc<span class="token punctuation">]</span> init<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> nprocess <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&gt;=</span> <span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">--</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
                    NSString <span class="token operator">*</span> processID <span class="token operator">=</span><span class="token punctuation">[</span><span class="token punctuation">[</span>NSString alloc<span class="token punctuation">]</span> initWithFormat<span class="token punctuation">:</span><span class="token string">@&quot;%d&quot;</span><span class="token punctuation">,</span> process<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_pid<span class="token punctuation">]</span><span class="token punctuation">;</span>
                    NSString <span class="token operator">*</span> processName <span class="token operator">=</span><span class="token punctuation">[</span><span class="token punctuation">[</span>NSString alloc<span class="token punctuation">]</span> initWithFormat<span class="token punctuation">:</span><span class="token string">@&quot;%s&quot;</span><span class="token punctuation">,</span> process<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_comm<span class="token punctuation">]</span><span class="token punctuation">;</span>
                    NSString <span class="token operator">*</span>processPriority <span class="token operator">=</span><span class="token punctuation">[</span><span class="token punctuation">[</span>NSString alloc<span class="token punctuation">]</span> initWithFormat<span class="token punctuation">:</span><span class="token string">@&quot;%d&quot;</span><span class="token punctuation">,</span> process<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_priority<span class="token punctuation">]</span><span class="token punctuation">;</span>
                    NSDate   <span class="token operator">*</span>processStartDate <span class="token operator">=</span><span class="token punctuation">[</span>NSDate dateWithTimeIntervalSince1970<span class="token punctuation">:</span>process<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_un<span class="token punctuation">.</span>__p_starttime<span class="token punctuation">.</span>tv_sec<span class="token punctuation">]</span><span class="token punctuation">;</span>
                    NSDictionary <span class="token operator">*</span>dict <span class="token operator">=</span><span class="token operator">@</span><span class="token punctuation">{</span>
                                          <span class="token string">@&quot;ProcessID&quot;</span><span class="token punctuation">:</span>processID<span class="token punctuation">,</span>
                                          <span class="token string">@&quot;ProcessPriority&quot;</span><span class="token punctuation">:</span>processPriority<span class="token punctuation">,</span>
                                          <span class="token string">@&quot;ProcessName&quot;</span><span class="token punctuation">:</span>processName<span class="token punctuation">,</span>
                                          <span class="token string">@&quot;ProcessStartDate&quot;</span><span class="token punctuation">:</span>processStartDate<span class="token punctuation">}</span><span class="token punctuation">;</span>
                    <span class="token punctuation">[</span>array addObject<span class="token punctuation">:</span>dict<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token punctuation">}</span>
                <span class="token function">free</span><span class="token punctuation">(</span>process<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">return</span> array<span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    <span class="token function">free</span><span class="token punctuation">(</span>process<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> nil<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br><span class="line-number">111</span><br><span class="line-number">112</span><br><span class="line-number">113</span><br><span class="line-number">114</span><br><span class="line-number">115</span><br><span class="line-number">116</span><br><span class="line-number">117</span><br><span class="line-number">118</span><br><span class="line-number">119</span><br><span class="line-number">120</span><br><span class="line-number">121</span><br><span class="line-number">122</span><br><span class="line-number">123</span><br><span class="line-number">124</span><br><span class="line-number">125</span><br><span class="line-number">126</span><br><span class="line-number">127</span><br><span class="line-number">128</span><br><span class="line-number">129</span><br><span class="line-number">130</span><br><span class="line-number">131</span><br><span class="line-number">132</span><br><span class="line-number">133</span><br><span class="line-number">134</span><br><span class="line-number">135</span><br><span class="line-number">136</span><br><span class="line-number">137</span><br><span class="line-number">138</span><br><span class="line-number">139</span><br><span class="line-number">140</span><br><span class="line-number">141</span><br><span class="line-number">142</span><br><span class="line-number">143</span><br><span class="line-number">144</span><br><span class="line-number">145</span><br><span class="line-number">146</span><br><span class="line-number">147</span><br><span class="line-number">148</span><br><span class="line-number">149</span><br><span class="line-number">150</span><br><span class="line-number">151</span><br><span class="line-number">152</span><br><span class="line-number">153</span><br><span class="line-number">154</span><br><span class="line-number">155</span><br><span class="line-number">156</span><br><span class="line-number">157</span><br><span class="line-number">158</span><br><span class="line-number">159</span><br></div></div><h2 id="检测应用重签名"><a href="#检测应用重签名" class="header-anchor">#</a> 检测应用重签名</h2> <p>应用重签名后就可以安装在没有越狱的手机上进行调试，我们可以检测应用是否重签名来阻止运行。一般重签名会改变应用的 bundle id ，我们可以通过比较当前应用的 bundle id 是否与我们自己的一致来判断。</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code><span class="token comment">// 获取当前应用的bundleId来比较</span>
NSString <span class="token operator">*</span>bundleId <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token punctuation">[</span>NSBundle mainBundle<span class="token punctuation">]</span> infoDictionary<span class="token punctuation">]</span> objectForKey<span class="token punctuation">:</span><span class="token punctuation">(</span>__bridge NSString <span class="token operator">*</span><span class="token punctuation">)</span>kCFBundleIdentifierKey<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token punctuation">[</span>bundleId isEqualToString<span class="token punctuation">:</span><span class="token string">@&quot;My Bundle Id&quot;</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">// 与自己的id不同说明被重签名</span>
    <span class="token keyword">return</span> NO<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">//取出embedded.mobileprovision这个描述文件的内容进行判断</span>
NSString <span class="token operator">*</span>mobileProvisionPath <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>NSBundle mainBundle<span class="token punctuation">]</span> pathForResource<span class="token punctuation">:</span><span class="token string">@&quot;embedded&quot;</span> ofType<span class="token punctuation">:</span><span class="token string">@&quot;mobileprovision&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>mobileProvisionPath<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">// 获取文件的内容</span>
    NSData <span class="token operator">*</span>mobileProvisionData <span class="token operator">=</span> <span class="token punctuation">[</span>NSData dataWithContentsOfFile<span class="token punctuation">:</span>mobileProvisionPath<span class="token punctuation">]</span><span class="token punctuation">;</span>
    NSString <span class="token operator">*</span>mobileProvisionContent <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>NSString alloc<span class="token punctuation">]</span> initWithData<span class="token punctuation">:</span>mobileProvisionData encoding<span class="token punctuation">:</span>NSASCIIStringEncoding<span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token comment">// 获取文件中plist的起始位置</span>
    NSRange plistStartRange <span class="token operator">=</span> <span class="token punctuation">[</span>mobileProvisionContent rangeOfString<span class="token punctuation">:</span><span class="token string">@&quot;&lt;plist&gt;&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token comment">// 获取文件中plist的结束位置</span>
    NSRange plistEndRange <span class="token operator">=</span> <span class="token punctuation">[</span>mobileProvisionContent rangeOfString<span class="token punctuation">:</span><span class="token string">@&quot;&lt;/plist&gt;&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>plistStartRange<span class="token punctuation">.</span>location <span class="token operator">!=</span> NSNotFound <span class="token operator">&amp;&amp;</span> plistEndRange<span class="token punctuation">.</span>location <span class="token operator">!=</span> NSNotFound<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">// 获取plist的内容</span>
        NSString <span class="token operator">*</span>plistContent <span class="token operator">=</span> <span class="token punctuation">[</span>mobileProvisionContent substringWithRange<span class="token punctuation">:</span><span class="token function">NSMakeRange</span><span class="token punctuation">(</span>plistStartRange<span class="token punctuation">.</span>location<span class="token punctuation">,</span> <span class="token function">NSMaxRange</span><span class="token punctuation">(</span>plistEndRange<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token comment">// 解析plist</span>
        NSDictionary <span class="token operator">*</span>result <span class="token operator">=</span>  <span class="token punctuation">[</span>NSPropertyListSerialization propertyListWithData<span class="token punctuation">:</span><span class="token punctuation">[</span>plistContent dataUsingEncoding<span class="token punctuation">:</span>NSUTF8StringEncoding<span class="token punctuation">]</span> options<span class="token punctuation">:</span>NSPropertyListImmutable format<span class="token punctuation">:</span>nil error<span class="token punctuation">:</span>nil<span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token comment">// 获取前缀</span>
        NSArray <span class="token operator">*</span>applicationIdentifierPrefix <span class="token operator">=</span> <span class="token punctuation">[</span>result objectForKey<span class="token punctuation">:</span><span class="token string">@&quot;ApplicationIdentifierPrefix&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token comment">// 获取带有前缀的bundleId</span>
        NSString <span class="token operator">*</span>bundleId <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">[</span>result objectForKey<span class="token punctuation">:</span><span class="token string">@&quot;Entitlements&quot;</span><span class="token punctuation">]</span> objectForKey<span class="token punctuation">:</span><span class="token string">@&quot;application-identifier&quot;</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token comment">// 检测带有前缀的bundleId是否与自己的一致</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>bundleId <span class="token operator">&amp;&amp;</span> <span class="token punctuation">[</span>bundleId isEqualToString<span class="token punctuation">:</span><span class="token string">@&quot;My Bundle Id&quot;</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> YES<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><h2 id="阻止动态调试"><a href="#阻止动态调试" class="header-anchor">#</a> 阻止动态调试</h2> <h3 id="ptrace"><a href="#ptrace" class="header-anchor">#</a> ptrace</h3> <p>我们可以在 main 函数中添加下面的方法来阻止动态调试</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code><span class="token macro property">#<span class="token directive keyword">import</span> &lt;dlfcn.h&gt;</span>
<span class="token macro property">#<span class="token directive keyword">import</span> &lt;sys/types.h&gt;</span>

<span class="token macro property">#<span class="token directive keyword">if</span> !defined(PT_DENY_ATTACH)</span>
<span class="token macro property">#<span class="token directive keyword">define</span> PT_DENY_ATTACH 31</span>
<span class="token macro property">#<span class="token directive keyword">endif</span>  </span><span class="token comment">// !defined(PT_DENY_ATTACH)</span>

<span class="token keyword">typedef</span> <span class="token keyword">int</span> <span class="token punctuation">(</span><span class="token operator">*</span>ptrace_ptr_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token keyword">int</span> _request<span class="token punctuation">,</span> pid_t _pid<span class="token punctuation">,</span> caddr_t _addr<span class="token punctuation">,</span> <span class="token keyword">int</span> _data<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">void</span> <span class="token function">disable_gdb</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">void</span><span class="token operator">*</span> handle <span class="token operator">=</span> <span class="token function">dlopen</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> RTLD_GLOBAL <span class="token operator">|</span> RTLD_NOW<span class="token punctuation">)</span><span class="token punctuation">;</span>
    ptrace_ptr_t ptrace_ptr <span class="token operator">=</span> <span class="token function">dlsym</span><span class="token punctuation">(</span>handle<span class="token punctuation">,</span> <span class="token string">&quot;ptrace&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">ptrace_ptr</span><span class="token punctuation">(</span>PT_DENY_ATTACH<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">dlclose</span><span class="token punctuation">(</span>handle<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token keyword">int</span> argc<span class="token punctuation">,</span> <span class="token keyword">char</span> <span class="token operator">*</span> argv<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">//在release模式下防动态调试</span>
<span class="token macro property">#<span class="token directive keyword">ifdef</span> __OPTIMIZE__</span>
    <span class="token function">disable_gdb</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token macro property">#<span class="token directive keyword">endif</span></span>
    <span class="token operator">@</span>autoreleasepool <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token function">UIApplicationMain</span><span class="token punctuation">(</span>argc<span class="token punctuation">,</span> argv<span class="token punctuation">,</span> nil<span class="token punctuation">,</span> <span class="token function">NSStringFromClass</span><span class="token punctuation">(</span><span class="token punctuation">[</span>AppDelegate class<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p>当然该方法也会被调试者下断点的方式来动态绕过或者使用 IDA 等反汇编工具打补丁绕过，所以我们应该在程序的多处地方调用 <code>disable_gdb()</code> 。</p> <h3 id="sysctl"><a href="#sysctl" class="header-anchor">#</a> sysctl</h3> <p>当一个进程被调试的时候，该进程会有一个标记来标记自己正在被调试，所以可以通过 sysctl 去查看当前进程的信息，看有没有这个标记位即可检查当前调试状态。</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code>BOOL <span class="token function">isDebuggerPresent</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">int</span> name<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span><span class="token punctuation">;</span>  <span class="token comment">//指定查询信息的数组</span>
    
    <span class="token keyword">struct</span> kinfo_proc info<span class="token punctuation">;</span> <span class="token comment">//查询的返回结果</span>
    size_t info_size <span class="token operator">=</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>info<span class="token punctuation">)</span><span class="token punctuation">;</span>
    
    info<span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_flag <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    
    name<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span> CTL_KERN<span class="token punctuation">;</span>
    name<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span> KERN_PROC<span class="token punctuation">;</span>
    name<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span> <span class="token operator">=</span> KERN_PROC_PID<span class="token punctuation">;</span>
    name<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token function">getpid</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>         
    
    <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">sysctl</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>info<span class="token punctuation">,</span> <span class="token operator">&amp;</span>info_size<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
        <span class="token function">NSLog</span><span class="token punctuation">(</span><span class="token string">@&quot;sysctl error ...&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> NO<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    
    <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>info<span class="token punctuation">.</span>kp_proc<span class="token punctuation">.</span>p_flag <span class="token operator">&amp;</span> P_TRACED<span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br></div></div><h3 id="syscall"><a href="#syscall" class="header-anchor">#</a> syscall</h3> <p>为从实现从用户态切换到内核态，系统提供了一个系统调用函数 syscall，上面讲到的 ptrace 也是通过系统调用去实现的。</p> <p>在<a href="https://www.theiphonewiki.com/wiki/Kernel_Syscalls" target="_blank" rel="noopener noreferrer"> Kernel Syscalls<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> 这里可以找到 ptrace 对应的编号。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>26. ptrace               801e812c T
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>所以如下的调用等同于调用 ptrace:</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code><span class="token function">syscall</span><span class="token punctuation">(</span><span class="token number">26</span><span class="token punctuation">,</span><span class="token number">31</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="arm"><a href="#arm" class="header-anchor">#</a> arm</h3> <p>syscall 是通过软中断来实现从用户态到内核态，也可以通过汇编 svc 调用来实现。</p> <div class="language-c line-numbers-mode"><pre class="language-c"><code><span class="token macro property">#<span class="token directive keyword">ifdef</span> __arm__</span>
        <span class="token keyword">asm</span> <span class="token keyword">volatile</span><span class="token punctuation">(</span>
            <span class="token string">&quot;mov r0,#31\n&quot;</span>
            <span class="token string">&quot;mov r1,#0\n&quot;</span>
            <span class="token string">&quot;mov r2,#0\n&quot;</span>
            <span class="token string">&quot;mov r12,#26\n&quot;</span>
            <span class="token string">&quot;svc #80\n&quot;</span>
        
        <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token macro property">#<span class="token directive keyword">endif</span></span>
<span class="token macro property">#<span class="token directive keyword">ifdef</span> __arm64__</span>
        <span class="token keyword">asm</span> <span class="token keyword">volatile</span><span class="token punctuation">(</span>
            <span class="token string">&quot;mov x0,#26\n&quot;</span>
            <span class="token string">&quot;mov x1,#31\n&quot;</span>
            <span class="token string">&quot;mov x2,#0\n&quot;</span>
            <span class="token string">&quot;mov x3,#0\n&quot;</span>
            <span class="token string">&quot;mov x16,#0\n&quot;</span>
            <span class="token string">&quot;svc #128\n&quot;</span>
        <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token macro property">#<span class="token directive keyword">endif</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br></div></div><h2 id="字符串加密"><a href="#字符串加密" class="header-anchor">#</a> 字符串加密</h2> <p>程序中硬编码的字符串会在反编译软件中直接暴露出来，因此我们要对程序中重要的字符串 (如加密秘钥) 进行混淆处理，常用的方法为异或加密。</p> <div class="language-objectivec line-numbers-mode"><pre class="language-objectivec"><code><span class="token comment">// 定义一个宏来作为我们异或的key</span>
<span class="token macro property">#<span class="token directive keyword">define</span> KEY 0xBB</span>

<span class="token comment">// 将要加密的字符串拆解为字符数组，将每个字符与key进行异或</span>
<span class="token comment">// 以加密 hello 为例，末尾加 \0 为结束</span>
<span class="token keyword">unsigned</span> <span class="token keyword">char</span> str<span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'h'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                       <span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'e'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                       <span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'l'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                       <span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'l'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                       <span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'o'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
                       <span class="token punctuation">(</span>KEY <span class="token operator">^</span> <span class="token string">'\0'</span><span class="token punctuation">)</span><span class="token punctuation">}</span><span class="token punctuation">;</span>


<span class="token comment">// 解密方法,恢复加密后的字符串</span>
<span class="token keyword">void</span> <span class="token function">recoverString</span><span class="token punctuation">(</span><span class="token keyword">unsigned</span> <span class="token keyword">char</span> <span class="token operator">*</span>str<span class="token punctuation">,</span> <span class="token keyword">unsigned</span> <span class="token keyword">char</span> key<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">unsigned</span> <span class="token keyword">char</span> <span class="token operator">*</span>p <span class="token operator">=</span> str<span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token punctuation">)</span> <span class="token operator">^</span><span class="token operator">=</span>  key<span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token string">'\0'</span><span class="token punctuation">)</span>  p<span class="token operator">++</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// 使用字符串时先解密</span>
<span class="token comment">// str 为加密后的字符数组</span>
<span class="token function">recoverString</span><span class="token punctuation">(</span>str<span class="token punctuation">,</span> KEY<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">static</span> <span class="token keyword">unsigned</span> <span class="token keyword">char</span> result<span class="token punctuation">[</span><span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token function">memcpy</span><span class="token punctuation">(</span>result<span class="token punctuation">,</span> str<span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">NSLog</span><span class="token punctuation">(</span><span class="token string">@&quot;%s&quot;</span><span class="token punctuation">,</span>result<span class="token punctuation">)</span><span class="token punctuation">;</span>      <span class="token comment">//output: hello</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div></div> <footer class="page-edit" style="display:none;"><!----> <!----></footer> <!----> <!----></main> <!----> <div class="comments-wrapper" data-v-0cb1c278><div class="valine-wrapper"><div id="valine"></div></div></div></div></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-a81d141e data-v-a81d141e><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-a81d141e><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-a81d141e></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-a81d141e></path></svg></div><canvas id="vuepress-canvas-ribbon"></canvas><div class="my-popup" style="display:none;" data-v-3414bdeb><div class="my-popup-container" data-v-3414bdeb><div class="my-popup-exit" data-v-3414bdeb></div> <img src="" alt data-v-3414bdeb></div></div><div data-v-2ebabc0c></div><div class="kanbanniang" data-v-3b0f9b07><div class="banniang-container" style="display:;" data-v-3b0f9b07><div class="messageBox" style="right:68px;bottom:230px;display:none;" data-v-3b0f9b07>
      欢迎来到 KnightSama‘s Blog
    </div> <div class="operation" style="right:90px;bottom:40px;display:;" data-v-3b0f9b07><i class="kbnfont kbn-ban-home ban-home" data-v-3b0f9b07></i> <i class="kbnfont kbn-ban-message message" data-v-3b0f9b07></i> <i class="kbnfont kbn-ban-close close" data-v-3b0f9b07></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-3b0f9b07><i class="kbnfont kbn-ban-info info" data-v-3b0f9b07></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:;" data-v-3b0f9b07></i></div> <canvas id="banniang" width="200" height="260" class="live2d" style="right:90px;bottom:-20px;opacity:0.9;" data-v-3b0f9b07></canvas></div> <div class="showBanNiang" style="display:none;" data-v-3b0f9b07>
    看板娘
  </div></div></div></div>
    <script src="/assets/js/app.a2483de7.js" defer></script><script src="/assets/js/4.0078dadf.js" defer></script><script src="/assets/js/1.c3e7d2b0.js" defer></script><script src="/assets/js/18.fa3c3a4e.js" defer></script>
  </body>
</html>
